﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBeamLibrary.Events;
using JBeamLibrary.VehicleParts.Elements;
using JBeamLibrary.VehicleParts.Interfaces;

namespace JBeamLibrary.VehicleParts.Collections
{
    public class HubWheelsCollection : KeyedCollection<string, HubWheel>, IVehicleGroupCollection<HubWheel>
    {
        #region Fields

        public event ElementPropertyChangedEventHandler ElementPropertyChanged;

        #endregion

        protected override string GetKeyForItem(HubWheel item)
        {
            return item.Name;
        }

        public new void Add(HubWheel element)
        {
            base.Add(element);

            element.PropertyChanged += (s, e) =>
            {
                if (ElementPropertyChanged != null)
                    ElementPropertyChanged(s, e);
            };
        }

        public new void Remove(HubWheel element)
        {
            base.Remove(element);
        }
    }
}
